Skip to content

Fix log-pane for rust-based core-utils#14

Open
pantaray wants to merge 2 commits into
UCL-ARC:masterfrom
esi-neuroscience:master
Open

Fix log-pane for rust-based core-utils#14
pantaray wants to merge 2 commits into
UCL-ARC:masterfrom
esi-neuroscience:master

Conversation

@pantaray

Copy link
Copy Markdown

First of all, thank you for this amazing tool! We've relied on it for teaching and people absolutely love it! The history pane on top is super useful for learners - and helpful for instructors too (in case you lost your train of thought)!

Prepping for our upcoming workshop, we've noticed that the history pane on top was created correctly but did not show anything. Turns out this seems to be a buffering issue on modern Ubuntu (25.10+) systems, that migrated GNU coreutils to Rust-based uutils/coreutils. That renders buffer-control via stdbuf ineffective for the rust-based nl, so that adding line numbers to the history remains buffered and nothing shows up in the top pane.

We've updated the respective tmux new-session -d -s "${SESSION}" ... line to instead rely solely on awk and its built-in fflush() function. To preserve backwards compatibility, the existing stdbuf-based command is still there and used if the installed version of awk does not support fflush() (may be the case for some very old macOS/Linux machines).

Thanks again for this super helpful tool!

Buffering via stdbuf only works with C code using stdio; modern
Ubuntu (25.10+) uses a re-write of the core-utils in rust, which
stdbuf has no effect on. Updated the log-pane setup to instead
rely solely on awk and its built-in fflush() function
Comment thread swc-shell-split-window.sh
Comment on lines +47 to +50
tail -f '${LOG_FILE}' | \
stdbuf -o 0 nl -s'%' -n'ln' -w1 | \
stdbuf -o0 grep -v '%#' | \
awk -F'%' '{print \"\033${CYAN}\"\$1\"\033[0m\",\$2}'"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you keep the comments that were in the previous code? Explaining also what's going on in the code above would nice, too.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point - comments included in c46f7e4

On branch master
Changes to be committed:
	modified:   swc-shell-split-window.sh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants